home *** CD-ROM | disk | FTP | other *** search
- Game Input Read Me.txt
- ======================
-
- REALbasic 5.5 introduces some new classes that allow you to access
- game input devices, such as joysticks, game pads, and the keyboard,
- on certain computer systems.
-
- System Requirements
- -------------------
- Windows: DirectX 8 must be installed in order to access any input
- devices (including the keyboard).
-
- MacOS 8-9: only the keyboard and main mouse button are available as
- input devices.
-
- Mac OS X: the keyboard and mouse button are always available, as on
- MacOS 8-9. In addition, as long as you have the file called
- "HID.Bundle" in the same folder as your application, you'll be able
- to access other game input devices such as joysticks. (We may allow
- this file to be found in other locations in the future.)
-
- Usage
- -----
- To use the new functionality, make a single instance of the
- GameInputManager class. You can then ask it for a list of available
- devices, and get a list of elements (such as buttons or joystick
- axes) from each device. In addition, you can ask the
- GameInputManager to wait for the user to wiggle or press any element,
- and return the element so indicated. This can be used to allow
- configuration of your game controls.
-
-
- GameInputManager class
- ----------------------
- Methods:
- DeviceCount as Integer -- Counts the number of input devices attached
-
- Device(index as Integer) as GameInputDevice -- Gets the device at that index
-
- WaitForElement(timeout as Single) as GameInputElement -- Waits for
- an element to change on any input device. The timeout is specified
- in seconds.
-
-
- GameInputDevice class
- ---------------------
- Properties:
- Index as Integer -- The index of this device in the manager
-
- Name as String -- The human-readable, unique name for the device
-
- Connected as Boolean -- Whether the device is currently considered connected
-
- ElementCount as Integer -- The number of elements the device has
-
- Methods:
- Element(index as Integer) as GameInputElement -- gets the element
- indexed from the device
-
-
- GameInputElement class
- ----------------------
- Properties:
- Name as String -- the name of the element
-
- Device as GameInputDevice -- the device that owns this element
-
- Value as Integer -- the current value of this element
-
-
- Examples
- --------
- (mManager and mFireButton are both global properties of type
- GameInputManager and GameInputElement, respectively).
-
- ----------
- ' Make sure we have an input manager
- if mManager = nil then
- mManager = new GameInputManager
- end
-
- ' Let's find out what element the user would like to use
- ' as their fire key.
- mFireButton = mManager.WaitForElement( 3 ) ' wait for 3 seconds, then give up
-
- if mFireButton <> nil then
- MsgBox "You are now using " + mFireButton.Name + " as your fire key"
- end
- -----------
- ' Let's check to see if the user fired, and if they did, we
- ' will do something really cool!
- if mFireButton <> nil and mFireButton.Value <> 0 then
- DoSomethingReallyCool()
- end
- ------------
-
- The first example shows how you can allow the user to configure what
- devices and actions on those devices will correspond to your game's
- actions. The second example shows how you can use an element to
- determine whether it is time to do its corresponding game action.
- Note that in the second example, we are polling for the current state
- of that element (instead of getting an old value out of it).
-
-